#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2020-07-30 11:14 上午
# @Author  : yangdy
# @File    : 2020-07-30.343.整数拆分
# @Software: PyCharmCE


class Solution:
    def integerBreak(self, n: int) -> int:
        if n < 4:
            return n-1
        import math
        p, q = n // 3, n % 3
        if q == 0:
            return int(math.pow(3, p))
        elif q == 1:
            return int(math.pow(3, p-1) * 4)
        else:
            return int(math.pow(3, p) * 2)
